package com.company;

import java.util.Comparator;

public class Teacher implements Comparator<Teacher> {
    private int stu_no;
    private String name;
    private int age;

    public Teacher(int stu_no, String name, int age) {
        this.stu_no = stu_no;
        this.name = name;
        this.age = age;
    }

    public Teacher() {
    }

    public int getStu_no() {
        return stu_no;
    }

    public void setStu_no(int stu_no) {
        this.stu_no = stu_no;
    }

    @Override
    public int compare(Teacher o1, Teacher o2) {
        int i = 0;
        if(o1.stu_no > o2.stu_no){
            i = 1;
        }
        if(o1.stu_no < o2.stu_no){
            i = -1;
        }

        return i;
    }

    @Override
    public String toString() {
        return "学号:"+this.stu_no + "\t姓名:" + this.name+ "\t年龄：" + this.age;
    }
}
